package cn.ware.house.interfaces.service.impl;

import cn.ware.house.interfaces.entity.OutboundRecord;
import cn.ware.house.interfaces.mapper.OutboundRecordMapper;
import cn.ware.house.interfaces.service.OutboundRecordService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;

/**
 * 出库记录服务接口的实现类，实现了出库记录业务逻辑操作的具体方法，
 * 通过调用出库记录数据访问层（OutboundRecordMapper）的方法来与数据库进行交互，
 * 完成如查询、插入、更新、删除等业务功能。
 */
@Service
public class OutboundRecordServiceImpl implements OutboundRecordService {

    @Resource
    private OutboundRecordMapper outboundRecordMapper;

    @Override
    public OutboundRecord findOutboundRecordById(Integer outboundId) {
        return outboundRecordMapper.selectOutboundRecordById(outboundId);
    }

    @Override
    public List<OutboundRecord> findAllOutboundRecords() {
        return outboundRecordMapper.selectAllOutboundRecords();
    }

    @Override
    public boolean insertOutboundRecord(OutboundRecord outboundRecord) {
        int rows = outboundRecordMapper.insertOutboundRecord(outboundRecord);
        return rows > 0;
    }

    @Override
    public boolean updateOutboundRecordById(OutboundRecord outboundRecord) {
        int rows = outboundRecordMapper.updateOutboundRecordById(outboundRecord);
        return rows > 0;
    }

    @Override
    public boolean deleteOutboundRecordById(Integer outboundId) {  int rows = outboundRecordMapper.deleteOutboundRecordById(outboundId);
        return rows > 0;}
}